const express=require("express")

const app=express()

//全局注册express的内置中间件express.json()
//该中间件可以解析请求体中的json格式数据
app.use(express.json())
//注册urlencoded中间件ed
//解析urlencoded合适的数据
app.use(express.urlencoded({extended:false}))

app.get("/user",(req,res)=>{
    console.log(req.body)
    let man=req.body
    console.log(`姓名${man.name},年龄${man.age}`)
    res.send(req.body)
})

app.get("/book",(req,res)=>{
    console.log(req.body)
    res.send(req.body)
})


app.listen(80,()=>{
    console.log("runing at server 127.0.0.1")
})